package ma.jee.portailReservation.service.ma.jee.portailReservation.service.reservation.Impl;

import ma.jee.portailReservation.persistence.reservation.IReglementDAO;
import ma.jee.portailReservation.persistence.reservation.Reglement;
import ma.jee.portailReservation.service.ma.jee.portailReservation.service.reservation.DisplayReglement;
import ma.jee.portailReservation.service.ma.jee.portailReservation.service.reservation.IDisplayReglementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: soufiane
 * Date: 27/12/11
 * Time: 00:00
 * To change this template use File | Settings | File Templates.
 */
@Service("defaultDisplayReglementService")
public class DefaultDisplayReglementService implements IDisplayReglementService{

    @Autowired
	@Qualifier("hibernateReglementDAO")
	private IReglementDAO reglementDAO;

    @Override
    @Transactional(readOnly=true)
    public List<DisplayReglement> getAllDisplayReglements() {
         List<DisplayReglement> result = new ArrayList< DisplayReglement >();

        for(Reglement reglement : reglementDAO.findAll()) {
                  result.add(new DisplayReglement(reglement));
        }

        return result;
    }
}
